package com.gamex.findit.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gamex.findit.dao.FriendMapper;
import com.gamex.findit.model.Friend;
import com.gamex.findit.service.FriendService;

/**
 * 친구 서비스
 * @author james
 *
 */
@Service
public class FriendServiceImpl implements FriendService{
	
	private static final Logger logger = LoggerFactory.getLogger(FriendServiceImpl.class);

	@Autowired FriendMapper friendMapper;
	
	@Override
	public List<Friend> getFriend(Friend friend) {
		List<Friend> result = null;
		try {
			result = friendMapper.selectFriend(friend);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return result;
	}

	@Override
	public int getFriendCount(Friend Friend) {
		int count = 0;
		try {
			count = friendMapper.selectFriendCount(Friend);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return count;
	}

	@Override
	public Friend getFriendView(Friend friend) {
		Friend result = null;
		try {
			result = friendMapper.selectFriendView(friend);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return result;
	}

	@Override
	public void insertFriend(Friend userId) {
		try {
			friendMapper.insertFriend(userId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
	}

	@Override
	public void updateFriend(Friend friend) {
		try {
			friendMapper.updateFriend(friend);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		
	}

	@Override
	public void deleteFriend(Friend friend) {
		try {
			friendMapper.deleteFriend(friend);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		
	}

}
